package com.it.park.service.kafka;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.stereotype.Service;

import com.alibaba.fastjson.JSONObject;
import com.it.park.client.kafka.KafkaProducerService;
import com.it.park.service.redis.RedisCacheManager;

@Service("kafkaProducer")
public class KafkaProducerServiceImpl implements KafkaProducerService{

	@Resource
	private KafkaTemplate<String, Object> kafkaTemplate;
	@Resource
	private RedisCacheManager redisCacheManager;

	@Override
	public void sendMessage(List<String> messages) {
		String data = JSONObject.toJSONString(messages);
		redisCacheManager.set("json",data);
		System.out.println(redisCacheManager.get("username"));
		kafkaTemplate.sendDefault(data);
	}
}
